import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContentTagVO, ContentTagForm, ContentTagQuery } from '@/api/business/contentTag/types';

/**
 * 查询统一内容标签定义列表
 * @param query
 * @returns {*}
 */

export const listContentTag = (query?: ContentTagQuery): AxiosPromise<ContentTagVO[]> => {
  return request({
    url: '/business/contentTag/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询统一内容标签定义详细
 * @param id
 */
export const getContentTag = (id: string | number): AxiosPromise<ContentTagVO> => {
  return request({
    url: '/business/contentTag/' + id,
    method: 'get'
  });
};

/**
 * 新增统一内容标签定义
 * @param data
 */
export const addContentTag = (data: ContentTagForm) => {
  return request({
    url: '/business/contentTag',
    method: 'post',
    data: data
  });
};

/**
 * 修改统一内容标签定义
 * @param data
 */
export const updateContentTag = (data: ContentTagForm) => {
  return request({
    url: '/business/contentTag',
    method: 'put',
    data: data
  });
};

/**
 * 删除统一内容标签定义
 * @param id
 */
export const delContentTag = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/contentTag/' + id,
    method: 'delete'
  });
};
